home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-04 | 2.2 KB | 87 lines | [TEXT/KAHL] |
- /********************************************************* DEFINITION
- DATE: 9/23/93
- AUTHOR: Eric R. Rosé
-
- CLASS: CPPCheckBox
-
- SUPERCLASS: CPPControl
-
- This C++ class manages a checkbox control
-
- ********************************************************************/
-
- #include <CPPCheckBox.h>
-
- extern Rect kDefaultRect;
- extern Rect kEmptyRect;
-
- /*-----------------------------------------------------------------*/
- /*------------------------ PUBLIC METHODS -------------------------*/
- /*-----------------------------------------------------------------*/
-
- CPPCheckBox::CPPCheckBox (CPPWindow *itsWindow, short ResID,
- Boolean initiallyOn,
- Boolean canBeTarget,
- Boolean active, Boolean visible) :
- CPPControl (itsWindow, ResID, FALSE, canBeTarget,
- active, visible)
- /* load a control resource and initialize with the given data */
- {
-
- if (this->theControl)
- SetValue (initiallyOn);
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPCheckBox::CPPCheckBox (CPPWindow *itsWindow, Rect *itsBounds,
- StringPtr itsText, Boolean initiallyOn,
- Boolean useWindowFont,
- Boolean canBeTarget,
- Boolean active, Boolean visible) :
- CPPControl (itsWindow, itsBounds, checkBoxProc,
- itsText, FALSE, useWindowFont,
- canBeTarget, active, visible)
- {
- if (this->theControl)
- SetValue (initiallyOn);
- }
-
- /*-----------------------------------------------------------------*/
-
- CPPCheckBox::~CPPCheckBox (void)
- {
-
- }
-
- /*-----------------------------------------------------------------*/
-
- Boolean CPPCheckBox::Member (char *className)
- {
- if (strcmp(className, CPPCheckBox::ClassName()) == 0)
- return TRUE;
- else
- return CPPControl::Member(className);
- }
-
- /*-----------------------------------------------------------------*/
-
- char *CPPCheckBox::ClassName (void)
- {
- return "CPPCheckBox";
- }
-
- /*-----------------------------------------------------------------*/
-
- void CPPCheckBox::DoOnClick (void)
- /* toggle the value of the checkbox when it is clicked on */
- /* SUBCLASS MAY OVERRIDE */
- {
- if (this->theControl)
- SetValue ((GetValue() + 1) % 2);
-
- // let the superclass run the callback proc
- CPPControl::DoOnClick();
- }
-
-